import numpy as np
import pandas as pd
# s1 =pd.Series([1,4,7,10])
# print('使用列表创建的Series对象s1：\n',s1)
#
# arr = np.array([1,4,7,10])
# s2 = pd.Series(arr,['a','b','c','d'])
# print('使用数组创建的Series对象s2：\n',s2)
#
# s3 = pd.Series({'a':1,'b':4,'c':7,'d':10})
# print('使用字典创建的Series对象s3：\n',s3)

index = ['王蒙','李珊','赵胜','刘文']
columns = ['语文','数学','英语']
#创建字典
# dict = {'语文':[110,95,98,112],'数学':[120,112,80,106],'英语':[105,108,100,97],'班级':['高三（1）班','高三（2）班','高三（3）班','高三（4）班']}
# df1=pd.DataFrame(dict,index)
# print('使用字典创建的DataFrame对象df1：\n',df1)
#创建Series对象
s1 = pd.Series([110,120,105],columns)
s2 = pd.Series([95,110,108],columns)
s3 = pd.Series([98,80,100],columns)
s4 = pd.Series([112,106,97],columns)
df2 = pd.DataFrame([s1,s2,s3,s4],index)
print('使用Series对象创建的DataFrame对象df2：\n',df2)

print(df2.values)
print(df2.dtypes)
print(df2.index)
print(df2.columns)
print(df2.T)
print(df2.head(3))
print(df2.tail(3))
print(df2.shape)
print(df2.info)

index = ['王蒙','李珊','赵胜','刘文']
columns = ['语文','数学','英语']
df = pd.DataFrame(list,index,columns)
